package cate.common.table.farm.forbidden.sheet;

import cate.common.table.ESheet;
import cate.common.table.farm.forbidden.row.ForbiddenCombatRow;
import com.fasterxml.jackson.annotation.JsonIgnore;

import java.beans.Transient;
import java.util.List;
import java.util.stream.Collectors;

public class ForbiddenCombatSheet extends ESheet<ForbiddenCombatRow> {

    @Override
    public String getSheetName() {
        return "种族禁地副本关卡";
    }

    public ForbiddenCombatRow find(int roomId, int combatNum) {
        for (ForbiddenCombatRow row : this.getList()) {
            if (row.roomId == roomId && row.combatNum == combatNum) {
                return row;
            }
        }
        return null;
    }

    @JsonIgnore
    @Transient
    public List<ForbiddenCombatRow> getListByRoom(int roomId) {
        return list.stream().filter(row -> row.roomId == roomId).collect(Collectors.toList());
    }
}
